<template>
  <div id="app">
    <el-menu
      :default-active="activeIndex"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">
      <el-menu-item v-for="(item,i) in navBtn" :index="i.toString()" :key="i">{{ item.name }}</el-menu-item>
    </el-menu>
    <el-container>
      <el-main>
        <router-view/>
      </el-main>
    </el-container>
  </div>
</template>
<script>
export default {
  data() {
    return {
      activeIndex: '0',
      navBtn: [{name: "首页", router: "/"}, {name: "用户管理", router: "/user"}, {name: "日志记录", router: "/logs"}]
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      this.$router.push(this.navBtn[key].router);
    }
  }
}
</script>
<style lang="scss">
@import "assets/css/init.css";
</style>
